﻿Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.Web.Profile
Imports System.Web.Security
Imports ASPNET.StarterKit.DataAccessLayer

Namespace ASPNET.StarterKit.BusinessLogicLayer

    Public Class User
        'Skeleton Class for future use in retriving information concerning a user

        Private _username As String
        Private _firstname As String
        Private _lastname As String
        Private _empid As String
        Private _userinfo As MembershipUser

        Public Sub New()

        End Sub

        Public Sub New(ByVal UserID As String)
            If String.IsNullOrEmpty(UserID) Then
                Throw (New ArgumentOutOfRangeException("UserID"))
            End If

            Me._username = UserID
            Me._userinfo = Membership.GetUser(UserID)

            'TODO: Complete this area of the User Object
            Dim UserProfile As ProfileCommon = HttpContext.Current.Profile
            Me._firstname = UserProfile.FirstName
            Me._lastname = UserProfile.LastName
            Me._empid = UserProfile.EmpId

        End Sub

        Public ReadOnly Property UserName() As String

            Get
                If String.IsNullOrEmpty(Me._username) Then
                    Return String.Empty
                Else
                    Return Me._username
                End If
            End Get

        End Property

        Public ReadOnly Property FirstName() As String

            Get
                Return Me._firstname
            End Get

        End Property

        Public ReadOnly Property LastName() As String

            Get
                Return Me._lastname
            End Get

        End Property

        Public ReadOnly Property EmpId() As String

            Get
                Return Me._empid
            End Get

        End Property


    End Class

End Namespace
